package com.junxonline.plat.dao.repository;

import com.junxonline.plat.dao.model.HouseFloorPlan;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface FloorPlanRepository extends JpaRepository<HouseFloorPlan, Long>, JpaSpecificationExecutor<HouseFloorPlan> {

    HouseFloorPlan findByHouseFloorPlanId(Long floorPlanId);

    List<HouseFloorPlan> findByHouseFloorPlanIdIn(Long[] floorPlanIds);

    @Query(value = "SELECT floor_plan.* FROM plat_house_floor_plan floor_plan ORDER BY floor_plan.house_floor_plan_id DESC LIMIT 1", nativeQuery = true)
    HouseFloorPlan findByFloorPlanIdLast();

}
